package com.baozhun.mall.common.util

import android.content.Context
import com.baozhun.mall.common.R
import com.baozhun.mall.common.widget.dialog.CommonDialog
import com.lxj.xpopup.XPopup
import com.lxj.xpopup.impl.ConfirmPopupView
import com.lxj.xpopup.interfaces.OnCancelListener
import com.lxj.xpopup.interfaces.OnConfirmListener

/**
 * @Title：弹窗工具类
 * @Description：
 * @Author：xing.luo
 * @Since：2022/11/26
 * @Version：1.0.0
 */
object DialogUtil {

    fun showConfirmDialog(context: Context, content: String, confirmListener: OnConfirmListener) {
        showConfirmDialog(context, context.resources.getString(com.baozhun.mall.res.R.string.tips_title), content, confirmListener)
    }

    fun showConfirmDialog(context: Context, title: String, content: String, confirmListener: OnConfirmListener) {
        showConfirmDialog(context, title, content, context.resources.getString(com.baozhun.mall.res.R.string.confirm), context.resources.getString(com.baozhun.mall.res.R.string.cancel), confirmListener, OnCancelListener { })
    }

    fun showConfirmDialog(context: Context, title: String, content: String, confirmText: String, cancelText: String, confirmListener: OnConfirmListener, cancelListener: OnCancelListener) {
        CommonDialog(context, cancelListener, confirmListener)
            .title(title)
            .content(content)
            .confirmText(confirmText)
            .cancelText(cancelText)
            .show()
    }
}